package org.meichao.demo.service.csvJob;

import org.meichao.utils.RespInfoUtils;
import org.meichao.utils.vo.RespInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/csv")
public class CsvController {

    @Autowired
    private CsvJobServiceFactory csvJobServiceFactory;

    @RequestMapping(value = "/importCsvDataDemo" ,method = RequestMethod.GET)
    public RespInfo importCsvData(@RequestParam("filePath")String filePath,
                                  @RequestParam("charSet")String charSet){
        csvJobServiceFactory.getInstance("demo").importCVSFile(filePath, charSet);
        return RespInfoUtils.create().respSuccess("成功导入数据").toRespInfo();
    }
}
